/*
 * DxfELLIPSE.java
 *
 * Created on 5 de Dezembro de 2007, 15:56
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package importadorDXF;

import mathematics.Point3D;
import mathematics.Vector3D;

/**
 *
 * @author rafaelbuck
 */
public class DxfELLIPSE extends DxfEntity
{

    public boolean setGroup(short grpNr, float fval)
    {
        switch(grpNr)
        {
        case 10: // '\n'
        case 20: // '\024'
        case 30: // '\036'
            setCoord(center, grpNr / 10, fval);
            return true;

        case 11: // '\013'
        case 21: // '\025'
        case 31: // '\037'
            setCoord(axisDir, grpNr / 10, fval);
            return true;

        case 40: // '('
            aspectRatio = fval;
            break;

        case 41: // ')'
            startAngle = fval;
            break;

        case 42: // '*'
            endAngle = fval;
            break;

        default:
            return super.setGroup(grpNr, fval);
        }
        return false;
    }

    public void convert(Dxf14Converter converter, DxfFile dxf, Object collector)
    {
        converter.convert(this, dxf, collector);
    }

    public Point3D getCenter()
    {
        return center;
    }

    public Vector3D getAxisDir()
    {
        return axisDir;
    }

    public float getAspectRatio()
    {
        return aspectRatio;
    }

    public float getStartAngle()
    {
        return startAngle;
    }

    public float getEndAngle()
    {
        return endAngle;
    }

    /** Creates a new instance of DxfELLIPSE */
    public DxfELLIPSE()
    {
        center = new Point3D();
        axisDir = new Vector3D();
        endAngle = 6.283185F;
    }

    private Point3D center;
    private Vector3D axisDir;
    private float aspectRatio;
    private float startAngle;
    private float endAngle;
}